import TestMapper from "../dao/TestMapper";
import ProxyHandler from "../sql/ProxyHandler";
import SystemMember from "../entity/SystemMember";
import { v4 as uuidv4 } from 'uuid'

export default class TestService{
    private testMapper: TestMapper;
    private handler: ProxyHandler<SystemMember>;

    constructor() {
        this.testMapper = new TestMapper()
        this.handler = new ProxyHandler<SystemMember>();
    }


    test(){
        // const member = new SystemMember("system_member");
        // member.id = uuidv4()
        // member.name = "张三丰"
        // member.mobile = "15833334444"
        // const proxy = new Proxy(this.testMapper.insert, this.handler)
        // proxy(member)

        // const member = new SystemMember("system_member");
        // member.id = "6a5dfb02-14d1-4ffa-9a66-7877204deef2"
        // member.mobile = "13133334444"
        // member.age = 43
        // const proxy = new Proxy(this.testMapper.updateById, this.handler)
        // proxy(member)

        // const member = new SystemMember("system_member");
        // member.id = "3d21377d-ba1d-4445-98a0-43bf9e4c02a3"
        // const proxy = new Proxy(this.testMapper.deleteById, this.handler)
        // proxy(member)
        const params = {
            tableName: 'system_member',
            offset: 0,
            limit: 10,
            entity: [{
                key: "name",
                value: "张",
                operator: "LIKE"
            }]
        }

        const proxy = new Proxy(this.testMapper.page, this.handler)
        proxy(params)
    }
}
